import request from "./index";

export const getElderList = (params) => {
  return request({
    url: "/elder/list",
    method: "get",
    params,
  });
};

export const addElder = (data) => {
  return request({
    url: "/elder/add",
    method: "post",
    data,
  });
};

export const deleteElder = (id) => {
  return request({
    url: "/elder/delete",
    method: "delete",
    params: {
      id,
    },
  });
};

export const updateElder = (data) => {
  return request({
    url: "/elder/update",
    method: "post",
    data,
  });
};

export const getNurseList = (params) => {
  return request({
    url: "/nurse/list",
    method: "get",
    params,
  });
};

export const addNurse = (data) => {
  return request({
    url: "/nurse/add",
    method: "post",
    data,
  });
};

export const deleteNurse = (id) => {
  return request({
    url: "/nurse/delete",
    method: "delete",
    params: {
      id,
    },
  });
};

export const updateNurse = (data) => {
  return request({
    url: "/nurse/update",
    method: "post",
    data,
  });
};

export const getNurseById = (id) => {
  return request({
    url: `/nurse/getNurseById`,
    method: "get",
    params: { id },
  });
};
export const getElderById = (id) => {
  return request({
    url: `/elder/getElderById`,
    method: "get",
    params: { id },
  });
};
export const bindTask = (data) => {
  return request({
    url: `/nurse/bindTask`,
    method: "post",
    data,
  });
};
export const createPlan = (data) => {
  return request({
    url: `/nurse/createPlan`,
    method: "post",
    data,
  });
};
export const getPlanList = (params) => {
  return request({
    url: `/elderPlan/getPlanList`,
    method: "get",
    params,
  });
};
export const deletePlan = (id) => {
  return request({
    url: `/elderPlan/deletePlan`,
    method: "delete",
    params: { id },
  });
};
export const getTaskList = (params) => {
  return request({
    url: `/task/getTaskList`,
    method: "get",
    params,
  });
};
export const deleteTask = (id) => {
  return request({
    url: `/task/deleteTask`,
    method: "delete",
    params: { id },
  });
};
export const addTask = (data) => {
  return request({
    url: `/task/addTask`,
    method: "post",
    data,
  });
};

export const adminLogin = (data) => {
  return request({
    url: `/admin/login`,
    method: "post",
    data,
  });
};
export const nurseLogin = (data) => {
  return request({
    url: `/nurse/login`,
    method: "post",
    data,
  });
};
export const getCheckinCheckoutMonthlyCount = () => {
  return request({
    url: `/dashboard/getCheckinCheckoutMonthlyCount`,
    method: "get",
  });
};

export const getElderMonthlyCount = () => {
  return request({
    url: `/dashboard/getElderMonthlyCount`,
    method: "get",
  });
};
export const getElderCount = () => {
  return request({
    url: `/dashboard/getElderCount`,
    method: "get",
  });
};

export const getNurseCount = () => {
  return request({
    url: `/dashboard/getNurseCount`,
    method: "get",
  });
};

export const getCheckinCheckoutById = (elderId) => {
  return request({
    url: `/elderCheckinCheckout/getCheckinCheckoutById`,
    method: "get",
    params: {
      elderId,
    },
  });
};

export const addCheckinCheckout = (data) => {
  return request({
    url: `/elderCheckinCheckout/add`,
    method: "post",
    data,
  });
};
export const deleteCheckinCheckout = (id) => {
  return request({
    url: `/elderCheckinCheckout/delete`,
    method: "delete",
    params: { id },
  });
};

export const getFamilyByElder = (elderId) => {
  return request({
    url: `/elderFamily/getFamilyByElder`,
    method: "get",
    params: {
      elderId,
    },
  });
};

export const addFamily = (data) => {
  return request({
    url: `/elderFamily/addFamily`,
    method: "post",
    data,
  });
};
export const deleteFamily = (id) => {
  return request({
    url: `/elderFamily/deleteFamily`,
    method: "delete",
    params: { id },
  });
};
export const getHealthRecordById = (id) => {
  return request({
    url: `/healthRecord/getHealthRecordById`,
    method: "get",
    params: { id },
  });
};
export const createOrUpdateHealthRecord = (data) => {
  return request({
    url: `/healthRecord/createOrUpdateHealthRecord`,
    method: "post",
    data,
  });
};
export const finishTask = (data) => {
  return request({
    url: `/nurseTask/finishTask`,
    method: "post",
    data,
  });
};
export const changeNursePassword = (data) => {
  return request({
    url: `/nurse/changePassword`,
    method: "post",
    data,
  });
};
export const changeAdminPassword = (data) => {
  return request({
    url: `/admin/changePassword`,
    method: "post",
    data,
  });
};
